<?php /*a:3:{s:63:"D:\projects\original_admin\app\merchant\view\order\details.html";i:1754748406;s:61:"D:\projects\original_admin\app\merchant\view\common\base.html";i:1752764603;s:63:"D:\projects\original_admin\app\merchant\view\common\header.html";i:1752998083;}*/ ?>
<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<meta charset="UTF-8" />
	<meta name="renderer" content="webkit" />
	<meta name="force-rendering" content="webkit" />
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>管理系统</title>
	<script src="/static/merchant/js/jquery-min.js"></script>
	<link rel="stylesheet" href="/static/merchant/layui/css/layui.css">
	<script type="text/javascript" src="/static/merchant/layui/layui.js"></script>
	<link rel="stylesheet/less" type="text/css" href="/static/merchant/css/index.less" />
	<script src="/static/merchant/js/less.js"></script>
    
</head>
<body>
	<main class="CenterMain">
		<header class="Header">
    <div class="logo img_box">
        <img src="/static/merchant/images/logow.png">

    </div>
    <div class="top">
        <ul class="nav-buttons">
            <li id="toggle-btn">

                <span class="desktop-text layui-icon layui-icon-spread-left">
                </span>
                <span class="mobile-text">菜单</span>
            </li>
        </ul>
        <dl class="menu-btn">
            <a class="img_box ">
                <img src="/static/merchant/images/head1.png">
                <i class="msg"></i>
            </a>
            <a class="img_box">
                <img src="/static/merchant/images/head2.png">
            </a>
        </dl>
        <span class="hr"></span>
        <ul class="layui-nav">

            <li class="layui-nav-item" lay-unselect>
                <a href="javascript:;">
                    <img src="/static/merchant/images/sign-user.png" class="layui-nav-img">
                    <span>登陆人名称</span>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="account_info.html">个人信息</a></dd>
                    <dd><a href="account_pwd.html">密码修改</a></dd>
                    <dd style="text-align: center;"><a href="">退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>

</header>
<div class="Sidebar" id="sidebar">
    <ul class="menu">
        <li class="menu-item">
            <div lay-on="url" href="/" class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav22.png">
                    <img class="img2" src="/static/merchant/images/nav21.png">
                </div>
                <span>商品管理</span>
                <!-- <i class="layui-icon layui-icon-right"></i> -->
            </div>
        </li>
        <li class="menu-item <?php if($routers == 'order/list'): ?>  active <?php endif; ?>">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav32.png">
                    <img class="img2" src="/static/merchant/images/nav31.png">
                </div>
                <span>订单管理</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>
            <dl    <?php if($routers == 'order/list'): ?>  style="display: block;" <?php else: ?> style="display:none;" <?php endif; ?> >
                <dd>
                    <a href="/merchant/order.html"  <?php if($routers == 'order/list'): ?>  class="active" <?php endif; ?> >订单管理</a>
                </dd>
                <dd>
                    <a href="shop_back.html">退货管理</a>
                </dd>
                <dd>
                    <a href="review.html">订单评价</a>
                </dd>

            </dl>

        </li>
        <li class="menu-item ">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav42.png">
                    <img class="img2" src="/static/merchant/images/nav41.png">
                </div>
                <span>财务提现</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

            <dl style="display: none;">
                <dd>
                    <a href="finance_cash.html">提现</a>
                </dd>
                <dd>
                    <a href="finance_logs.html">记录</a>
                </dd>
            </dl>

        </li>
        <!-- <li class="menu-item ">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="images/nav52.png">
                    <img class="img2" src="images/nav51.png">
                </div>
                <span>消息中心</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

        </li> -->
        <li class="menu-item ">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav62.png">
                    <img class="img2" src="/static/merchant/images/nav61.png">
                </div>
                <span>店铺设置</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

            <dl style="display: none;">
                <dd>
                    <a href="store_info.html">店铺信息 </a>
                </dd>
                <dd>
                    <a href="store_notice.html">店铺公告</a>
                </dd>
                <dd>
                    <a href="store_model.html">运费模板</a>
                </dd>
            </dl>

        </li>
    </ul>
</div>
		 
<style>
    .layui-form-label{
        width: 100px;
    }
</style>
    <div class="Content" id="content">
        <div class="ContactPage  OrderInfo">
            <div class="title-tag">订单详情</div>
            <div class="order-container">
                <div class="order-info">
                    <div>

                        <span>订单号：<?php echo htmlentities((string) $order['order_id']); ?></span>
                        <!-- <span><i class="layui-icon layui-icon-print"></i>打印订单</span> -->
                    </div>
                    <div>
                        <span>支付方式：
                            <?php if($order['pay_type'] == 1): ?>微信支付
                            <?php elseif($order['pay_type'] == 2): ?>余额支付
                            <?php else: ?>其他
                            <?php endif; ?>
                        </span>
                        <span>订单状态：<?php echo htmlentities((string) $order['status_name']); ?></span>
                    </div>

                </div>
                <h5>订单信息</h5>
                <div class="progress-steps">
                    <div class="steps-wrapper">
                        <div class="step active">
                            <div class="step-circle">1</div>
                            <div class="step-text">提交订单<br><?php echo htmlentities((string) $order['add_time']); ?></div>
                        </div>
                        <div class="step <?php if($order['paid'] == 1): ?> active <?php endif; ?>">
                            <div class="step-circle">2</div>
                            <div class="step-text">订单支付<br><?php if($order['pay_time'] > 0): ?><?php echo htmlentities((string) date("Y-m-d H:i:s",!is_numeric($order['pay_time'])? strtotime($order['pay_time']) : $order['pay_time'])); ?><?php endif; ?><br></div>
                        </div>
                        <div class="step <?php if($order['status'] == 2): ?> active <?php endif; ?>">
                            <div class="step-circle">3</div>
                            <div class="step-text">商品发货</div>
                        </div>
                        <div class="step <?php if($order['status'] == 3): ?> active <?php endif; ?>">
                            <div class="step-circle">3</div>
                            <div class="step-text">收货完成</div>
                        </div>
                    </div>
                </div>
                <!-- 收货 & 开票信息 -->
                <ul class="info-row">
                    <li>
                        <div class="title">收货信息</div>

                        <dl>
                            <dd>收货人: <?php echo htmlentities((string) $order['real_name']); ?> </dd>
                            <dd> 收货电话: <?php echo htmlentities((string) $order['user_phone']); ?></dd>
                            <dd> 收货地址: <?php echo htmlentities((string) $order['user_address']); ?></dd>
                        </dl>

                    </li>

                    <!-- <li>
                        <div class="title">开票信息</div>

                        <dl>
                            <dd>发票类型：数电普票 </dd>
                            <dd> 发票拍头：深XXXXXXXXXXXXXXXXXXXXX</dd>
                            <dd> 纳税人识别号：91440300088583334H</dd>
                            <dd> 收票邮箱:13737732458@163.com</dd>
                        </dl>

                    </li> -->
                </ul>

                <!-- 商品信息表格 -->
                <div class="section-title"><i></i>全部</div>
                <div class="table-view">
                    <table class="goods-table layui-tab">
                        <thead>
                            <tr>
                                <th>商品信息</th>
                                <th>单价（元）</th>
                                <th>数量</th>
                                <th>小计（元）</th>
                                <!-- <th>状态</th> -->
                            </tr>
                        </thead>
                        <tbody>
                            <?php if(is_array($order['cartDetail']) || $order['cartDetail'] instanceof \think\Collection || $order['cartDetail'] instanceof \think\Paginator): $i = 0; $__LIST__ = $order['cartDetail'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cart): $mod = ($i % 2 );++$i;?> 
                                <tr>
                                    <td>
                                        <div class="shopName">

                                            <div class="img_100 img">
                                                <img src="<?php echo htmlentities((string) $cart['cart_info']['thumb']); ?>">
                                            </div>
                                            <div class="text">
                                                <b> <?php echo htmlentities((string) $cart['cart_info']['productInfo']['store_name']); ?> <?php echo htmlentities((string) $cart['cart_info']['productInfo']['attrInfo']['suk']); ?></b>
                                                <br> <br>
                                            </div>
                                        </div>

                                    </td>
                                    <td>¥<?php echo htmlentities((string) $cart['cart_info']['productInfo']['price']); ?></td>
                                    <td><?php echo htmlentities((string) $cart['cart_info']['cart_num']); ?></td>
                                    <td>

                                        <b class="ftc">¥<?php echo htmlentities((string) $cart['cart_info']['productInfo']['price']); ?> * <?php echo htmlentities((string) $cart['cart_info']['cart_num']); ?></b>
                                    </td>
                                    <!-- <td>
                                        <b class="ftc"><?php echo htmlentities((string) $order['status_name']); ?></b>
                                    </td> -->
                                </tr>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                           
                        </tbody>
                    </table>
                </div>
                <div class=" amount-summary">
                    <div class="item">
                        <span class="label">商品总件数：</span>
                        <span class="num" style="color: #ff4d4f;"><?php echo htmlentities((string) $order['total_num']); ?>件</span>
                    </div>
                </div>
                <div class="amount-summary grid-row">
                    <div class="md4 xs12">
                        <p>运费：<strong>¥<?php echo htmlentities((string) $order['freight_price']); ?></strong></p>
                    </div>
                    <div class="md4 xs12">
                        <p>优惠：<strong>¥<?php echo htmlentities((string) $order['deduction_price']); ?></strong></p>
                    </div>

                    <div class="item md4 xs12">
                        <span class="label">商品应付总额：</span>
                        <strong class="num">¥<?php echo htmlentities((string) $order['pay_price']); ?></strong>
                    </div>

                </div>

                <!-- 物流信息 -->
                <div class="section-title"><i></i>物流信息</div>
                <div class="logistics-info">
                    <ul class="logistics-list">
                        <!-- <div class="logistics-item">
                            <span>物流编号：</span>LP00648705879048
                        </div> -->
                        <div class="logistics-item">
                            <span>物流公司：</span><?php echo htmlentities((string) $order['delivery_name']); ?>
                        </div>
                        <div class="logistics-item">
                            <span>运单号：</span><?php echo htmlentities((string) $order['delivery_id']); ?>
                        </div>
                        <div class="logistics-item">
                            <span>发货时间：</span><?php echo htmlentities((string) $order['deliver_time']); ?>
                        </div>
                    </ul>


                    <div class="logistics-timeline">
                        <div class="timeline-item">
                            <div class="timeline-date">2024-05-10</div>
                            <div class="timeline-time">04:25:47</div>
                            <div class="timeline-content">[深圳市]<span style="color: #29A370;"> [深圳市]快件已发往
                                    [安徽合肥转运中心]</span></div>
                        </div>
                        <div class="timeline-item">
                            <div class="timeline-date"></div>
                            <div class="timeline-time">04:25:16</div>
                            <div class="timeline-content">[深圳市] [深圳市]快件已到达 [广东深圳转运中心]</div>
                        </div>
                        <div class="timeline-item">
                            <div class="timeline-date"></div>
                            <div class="timeline-time">03:39:55</div>
                            <div class="timeline-content">[深圳市] [深圳市]快件已发往 [广东深圳转运中心]</div>
                        </div>

                        <div class="timeline-item">
                        </div>
                        <div class="timeline-item">
                            <div class="timeline-date">2024-05-10</div>
                            <div class="timeline-time">22:06:59</div>
                            <div class="timeline-content">[东莞市] [东莞市] [广东东莞莞长安镇公司] (0769-23883755)的长营业部徐除名已收件
                            </div>
                        </div>
                    </div>

                    <div class="notice">
                        以上信息由物流公司提供，如无跟踪信息或有疑问，请咨询平台
                    </div>

                    <div class="action-foot-btns">
                        <!-- <button class="layui-btn">物流异常处理</button> -->
                        <?php if($order['status'] == 1): ?>
                            <button class="layui-btn" id="fillLogisticsBtn">填写物流信息</button>
                        <?php endif; ?>
                    </div>
                </div>

                <!-- 订单操作 -->
                <div class="section-title"><i></i> 订单管理</div>
                <div class="action-btns" style="border-top: 1px solid #ebeef5;">
                    <button class="layui-btn"  id="addRemarkBtn">订单备注</button>
                    <?php if($order['paid'] == 1): ?>
                         <button class="layui-btn" id="refundBtn">退款</button>
                    <?php endif; ?>
                    
                    <!-- <button class="layui-btn">退货退款</button>
                    <button class="layui-btn">仅退款</button>
                    <button class="layui-btn"> 其他退款</button> -->
                </div>
            </div>
        </div>
    </div>
    
    <!-- 填写物流信息弹窗模板 -->
    <script type="text/html" id="logisticsTpl">
        <form class="layui-form" lay-filter="logisticsForm" style="padding: 20px;">
            <div class="layui-form-item">
                <label class="layui-form-label">物流公司</label>
                <div class="layui-input-block">
                    <input type="text" name="express_name" lay-verify="required" placeholder="请输入物流公司" 
                           autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">物流单号</label>
                <div class="layui-input-block">
                    <input type="text" name="express_no" lay-verify="required" placeholder="请输入物流单号" 
                           autocomplete="off" class="layui-input">
                </div>
            </div>
        </form>
    </script>

    <!-- 退款弹窗模板 -->
    <script type="text/html" id="refundTpl">
        <form class="layui-form" lay-filter="refundForm" style="padding: 20px;">
            <div class="layui-form-item">
                <label class="layui-form-label">退款金额</label>
                <div class="layui-input-block">
                    <input type="number" name="refund_amount" lay-verify="required|number" 
                           value="<?php echo htmlentities((string) $order['pay_price']); ?>" placeholder="请输入退款金额" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">退款原因</label>
                <div class="layui-input-block">
                    <textarea name="refund_reason" lay-verify="required" placeholder="请输入退款原因" class="layui-textarea"></textarea>
                </div>
            </div>
        </form>
    </script>

    <!-- 订单备注弹窗模板 -->
    <script type="text/html" id="remarkTpl">
        <form class="layui-form" lay-filter="remarkForm" style="padding: 20px;">
            <div class="layui-form-item">
                <label class="layui-form-label">订单备注</label>
                <div class="layui-input-block">
                    <textarea name="remark" placeholder="请输入订单备注内容" class="layui-textarea"><?php echo htmlentities((string) (isset($order['remark']) && ($order['remark'] !== '')?$order['remark']:'')); ?></textarea>
                </div>
            </div>
        </form>
    </script>

	</main>
</body>
<script  src="/static/merchant/js/index.js"></script>
<script src="/static/merchant/js/base.js"></script>
 
<script>
    changeTitleName('订单详情');

    layui.use(['form', 'layer'], function(){
        var form = layui.form;
        var layer = layui.layer;
        var $ = layui.$;

        // 填写物流信息
        $('#fillLogisticsBtn').on('click', function(){
            layer.open({
                type: 1,
                title: '填写物流信息',
                content: $('#logisticsTpl').html(),
                area: ['500px', '300px'],
                btn: ['确认发货', '取消'],
                success: function(layero, index){
                    form.render();
                },
                yes: function(index, layero){
                    var express_no = layero.find('input[name="express_no"]').val().trim();
                    var express_name = layero.find('input[name="express_name"]').val().trim();
                    if(!express_name){
                        layer.msg('请输入物流公司');
                        return false;
                    }
                    if(!express_no){
                        layer.msg('请输入物流单号');
                        return false;
                    }

                    // 提交发货请求
                    $.post('/merchant/merchant-order-deliver', {
                        order_id: '<?php echo htmlentities((string) $order['order_id']); ?>',
                        express_no: express_no,
                        express_name : express_name
                    }, function(res){
                        if(res.code === 200){
                            layer.msg('发货成功', {icon: 1});
                            setTimeout(function(){
                                location.reload();
                            }, 1000);
                        }else{
                            layer.msg(res.msg || '发货失败', {icon: 2});
                        }
                    });
                }
            });
        });

        // 退款操作
        $('#refundBtn').on('click', function(){
            layer.open({
                type: 1,
                title: '订单退款',
                content: $('#refundTpl').html(),
                area: ['500px', '300px'],
                btn: ['确认退款', '取消'],
                success: function(layero, index){
                    form.render();
                },
                yes: function(index, layero){
                    var refund_amount = layero.find('input[name="refund_amount"]').val();
                    var refund_reason = layero.find('textarea[name="refund_reason"]').val().trim();
                    
                    if(!refund_amount){
                        layer.msg('请输入退款金额');
                        return false;
                    }
                    if(!refund_reason){
                        layer.msg('请输入退款原因');
                        return false;
                    }

                    // 提交退款请求
                    $.post('/merchant/merchant-order-refund', {
                        order_id: '<?php echo htmlentities((string) $order['order_id']); ?>',
                        refund_amount: refund_amount,
                        refund_reason: refund_reason
                    }, function(res){
                        if(res.code === 200){
                            layer.msg('退款申请已提交', {icon: 1});
                            setTimeout(function(){
                                location.reload();
                            }, 1000);
                        }else{
                            layer.msg(res.msg || '退款失败', {icon: 2});
                        }
                    });
                }
            });
        });

        // 订单备注
        $('#addRemarkBtn').on('click', function(){
            layer.open({
                type: 1,
                title: '订单备注',
                content: $('#remarkTpl').html(),
                area: ['500px', '250px'],
                btn: ['保存备注', '取消'],
                success: function(layero, index){
                    form.render();
                },
                yes: function(index, layero){
                    var remark = layero.find('textarea[name="remark"]').val().trim();
                    
                    // 提交备注请求
                    $.post('/merchant/merchant-order-remark', {
                        order_id: '<?php echo htmlentities((string) $order['order_id']); ?>',
                        remark: remark
                    }, function(res){
                        if(res.code === 200){
                            layer.msg('备注已保存', {icon: 1});
                            layer.close(index);
                        }else{
                            layer.msg(res.msg || '保存失败', {icon: 2});
                        }
                    });
                }
            });
        });
    });
</script>
>
</html>